/*
 * @Author: 45F
 * @LastEditors  : Hasbug
 * @Description: 配置文件
 * @Date: 2019-07-05 18:10:23
 * @LastEditTime : 2020-01-17 19:15:59
 */
const path = require("path");

const resolve = dir => {
  return path.join(__dirname, dir);
};
// const baseUrl = process.env.NODE_ENV === "production" ? "/" : "/"; //公司
const baseUrl = process.env.NODE_ENV === "production" ? "/kafka" : "/"; //市局

module.exports = {
  //基本路径
  publicPath: baseUrl, // 如果部署到非域名根目录，需要配置publicPath值为子目录
  // 放置静态资源的地方 (js/css/img/font/...)
  assetsDir: "static",
  lintOnSave: false,
  chainWebpack: config => {
    config.resolve.alias
      .set("@", resolve("src"))
      .set("_c", resolve("src/components"))
      .set("_conf", resolve("config"))
      .set("_public", resolve("public"));
  },
  productionSourceMap: false,
  devServer: {
    proxy: {
      "/api": {
        target: "http://172.16.26.45:19900/api/", // 数据交换平台
        changeOrigin: true,
        ws: false,
        pathRewrite: {
          "^/api": ""
        }
      }
    },
    overlay: {
      // 错误信息显示到浏览器上
      warnings: true,
      errors: true
    }
  },
  css: {
    // 开启样式追溯
    sourceMap: true
  },
  configureWebpack: {
    // 引用第三方库
    // externals: {
    //   'BMapLib': 'BMapLib'
    // }
  }
};
